package ute.mvc.dao;

import org.hibernate.SessionFactory;
import org.hibernate.criterion.Restrictions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import ute.mvc.model.SubmittedAssignment;
import ute.mvc.model.SubmittedTestAndQuizz;
import ute.mvc.service.SubmittedTestAndQuizzService;

@Repository("submittedAssignmentDAO")
public class SubmittedAssignmentDAOImpl implements SubmittedAssignmentDAO{
	@Autowired
	SessionFactory sessionFactory;

	public void addSubmittedAssignment(SubmittedAssignment submittedAssignment) {
		sessionFactory.getCurrentSession().save(submittedAssignment);
	}

	public void updateSubmittedAssignment(
			SubmittedAssignment submittedAssignment) {
		sessionFactory.getCurrentSession().merge(submittedAssignment);
		
	}

	public void deleteSubmittedAssignment(
			SubmittedAssignment submittedAssignment) {
		sessionFactory.getCurrentSession().delete(submittedAssignment);
		
	}

	public SubmittedAssignment getSubmittedAssignment(
			String submittedAssignmentId) {
		return (SubmittedAssignment) sessionFactory.getCurrentSession()
				.get(SubmittedAssignment.class, submittedAssignmentId);
	}

}
